/* File: run_stacked_DiD.do
 * Author: Luca Maini
 * Purpose: this file runs the script for the stacked DiD analysis in the paper
 *
 */



*** Define program to create Regression Tables and Figures

/* 	This program runs regressions for a list of dependent variables on a list 
	of merger event indicators. It also allows for a few pre-specified sample 
	restrictions and weights, which are occasionally used in robustness checks.
	
	Variables:
	
	table_tag --> identifies table number in the paper
	yList --> identifies dependent variables
	xList --> identifies event-study control variables
	sample --> identifies sample restrictions (ALL/FHM string)
	weights --> identifies weights in the regression (YES/NO string)
	graphs --> indicator for running the graph code or not
	
*/

capture clear programs
program define mergerPaperFigure
	
	args figure_tag data yVar sample span graph
	
	* select sample
	
	/*	Steps:
		
		1. Select sample of treated drugs (get a list by Product and year)
		2. Match to matched_cohort data
		3. set up the data for the stacked DiD
		4. Run the stacked DiD
		
	*/
	
	use "${coeffdir}\coefficients_`data'_final.dta", clear
	keep if `sample'
	keep Product year cem_varlist
	
	rename Product Treated_Product
	rename year yearAcq
	
	* merge 
	merge 1:m Treated_Product yearAcq cem_varlist using "${maindir}\matched_cohorts_`data'.dta", keep(match)
	
	order Treated_Product yearAcq year Product
	sort Treated_Product yearAcq year Product
	
	* Now set up the data for the stacked DiD
	gen t0 = yearAcq
	gen t = year - yearAcq
	keep if t >= -`span' & t <= `span'
	replace t = t + `span' + 1	// to avoid negative values
	
	gen treatedt = t * (treated == 1)
	gen controlt = t * (treated == 0)
	egen cohort = group(Treated_Product yearAcq)
	
	*** Graph: Balanced T, with FEs to control for panel and isolate year of acq.
	areg `yVar' ib`span'.t ib`span'.treatedt, absorb(Product) cluster(Product)
	
	local N = `span' * 2 + 1
	forvalues i = 1/`N' {
		capture local b_`i'_1 = _b[`i'.treatedt]	// we use capture because in some 
													// robustness checks we have very small 
													// sample sizes that do not not cover 
													// all years of data
		capture local se_`i'_1 = _se[`i'.treatedt]
		}
	
	clear
	set obs `N'
	
	gen diff = .
	gen diff_se = .
	
	gen t = _n - `span' - 1
	
	forvalues i = 1/`N' {
		capture replace diff = `b_`i'_1' in `i'
		capture replace diff_se = `se_`i'_1' in `i'
		}
	
	gen diff_lb = diff - 1.96*diff_se
	gen diff_ub = diff + 1.96*diff_se
	
	* save coefficients
	save "${coeffdir}\stacked-DiD\\`figure_tag'.dta", replace
		
	* Graph
	if "`graph'" == "YES" {
	graph set window fontface "${paperFont}"
		twoway	(connect diff t, ///
					color(gs0) msymbol(d)) ///
				(rspike diff_lb diff_ub t, ///
					lcolor(gs0)), ///
			xtitle("Years from acquisition", height(5)) xlabel(-`span'(1)`span') ///
			ytitle("Change relative to year prior to acquisition") ///
			ylabel(#5, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
			legend(off) name(diff, replace)
		graph export "${paperdir}\Figures\\`figure_tag'.pdf", as(pdf) replace
		graph export "${paperdir}\Figures\\`figure_tag'.eps", as(eps) replace
		}	
end



////////////////////////////////////////////////
////										////
////	SECTION 4. Horizontal acquisitions	////
////										////
////////////////////////////////////////////////

graph set window fontface "${paperFont}"


* Effect of horizontal acquisitions on net price
mergerPaperFigure "Figure 3a"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "valeant_ind == 0 & overlap == 1"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

* Split effect (HSR) of horizontal acquisitions on net price
mergerPaperFigure "Figure 4a1"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure 4a2"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure 4a1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure 4a2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(#5, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure 4a.pdf", as(pdf) replace
graph export "${paperdir}\Figures\Figure 4a.eps", as(eps) replace

* Split effect (HSR) of horizontal acquisitions on volume
mergerPaperFigure "Figure 5a1"	/// figure tag
				  "sales" /// data
				  "log_units"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure 5a2"	/// figure tag
				  "sales" /// data
				  "log_units"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure 5a1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure 5a2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(#5, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(2) region(color(none)))
graph export "${paperdir}\Figures\Figure 5a.pdf", as(pdf) replace
graph export "${paperdir}\Figures\Figure 5a.eps", as(eps) replace

* Split effect (HSR) of horizontal acquisitions on formulary coverage
mergerPaperFigure "Figure 5b1"	/// figure tag
				  "coverage" /// data
				  "glp"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure 5b2"	/// figure tag
				  "coverage" /// data
				  "glp"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure 5b1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure 5b2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(#5, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(7) height(23) region(color(none)))
graph export "${paperdir}\Figures\Figure 5b.pdf", as(pdf) replace
graph export "${paperdir}\Figures\Figure 5b.eps", as(eps) replace


////////////////////////////////////////////
////									////
////	SECTION 5. Portfolio analysis 	////
////									////
////////////////////////////////////////////

* Effect of cross-market acquisitions by larger company on net price, volume, coverage
mergerPaperFigure "Figure 6a"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & cross_market == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES" // graph

mergerPaperFigure "Figure 7a"	/// figure tag
				  "sales" /// data
				  "log_units"	/// yVar
				  "(valeant_ind == 0 & cross_market == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES" // graph

mergerPaperFigure "Figure 7b"	/// figure tag
				  "coverage" /// data
				  "glp"	/// yVar
				  "(valeant_ind == 0 & cross_market == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES" // graph

* acquisition of a blockbuster
mergerPaperFigure "Figure 8a"	/// figure tag
				  "sales" /// data
				  "log_net"	/// yVar
				  "(valeant_ind == 0 & bb_acq == 1 & placebo == 0 & overlap == 0)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

mergerPaperFigure "Figure 8b"	/// figure tag
				  "sales" /// data
				  "log_net"	/// yVar
				  "(valeant_ind == 0 & acq_by_bb == 1 & placebo == 0 & overlap == 0)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

mergerPaperFigure "Figure 8c"	/// figure tag
				  "sales" /// data
				  "log_net"	/// yVar
				  "(valeant_ind == 0 & port_gain == 1 & placebo == 0 & overlap == 0)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

mergerPaperFigure "Figure 8d"	/// figure tag
				  "sales" /// data
				  "log_net"	/// yVar
				  "(valeant_ind == 0 & port_loss == 1 & placebo == 0 & overlap == 0)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

				  
				  
////////////////////////////////////////////////////////////
////													////
////	APPENDIX C. Effects of Valeant acquisitions		////
////													////
////////////////////////////////////////////////////////////

mergerPaperFigure "Figure A11"	/// figure tag
				  "sales" /// data
				  "log_WAC"	/// yVar
				  "valeant == 1"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

mergerPaperFigure "Figure A12"	/// figure tag
				  "sales" /// data
				  "log_net"	/// yVar
				  "valeant == 1"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure A11.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure A12.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(-0.2(0.2)1) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Net price" ///
				 1 "List price") cols(1) ///
			   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure A1.pdf", as(pdf) replace
graph export "${paperdir}\Figures\Figure A1.eps", as(eps) replace


////////////////////////////////////////////
////									////
////	APPENDIX D. Robustness checks	////
////									////
////////////////////////////////////////////

graph set window fontface "${OAFont}"

* Split effect (HSR) of horizontal acquisitions on net price (ATC4)
mergerPaperFigure "Figure OA4a1"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & overlap_atc4_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure OA4a2"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & overlap_atc4_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure OA4a1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure OA4a2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(#5, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA4a.pdf", as(pdf) replace



////////////////////////////////////////////
////									////
////	APPENDIX E. Additional results	////
////									////
////////////////////////////////////////////

////////	E.1	Impact of horizontal acquisitions on other outcomes

* Split effect (HSR) of horizontal acquisitions on list price
mergerPaperFigure "Figure OA13a1"	/// figure tag
				  "sales" /// data
				  "log_WAC"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure OA13a2"	/// figure tag
				  "sales" /// data
				  "log_WAC"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure OA13a1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure OA13a2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel() xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA13a.pdf", as(pdf) replace

* Effect of cross-market acquisitions by larger company on list price
mergerPaperFigure "Figure OA14a"	/// figure tag
				  "sales" /// data
				  "log_WAC"	/// yVar
				  "(valeant_ind == 0 & cross_market == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

* Split effect (HSR) of horizontal acquisitions on net sales
mergerPaperFigure "Figure OA151"	/// figure tag
				  "sales" /// data
				  "log_sales"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure OA152"	/// figure tag
				  "sales" /// data
				  "log_sales"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure OA151.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure OA152.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(-1(1)2) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(2) height(20) region(color(none)))
graph export "${paperdir}\Figures\Figure OA15.pdf", as(pdf) replace

* Effect of cross-market acquisitions by larger company on net sales
mergerPaperFigure "Figure OA16"	/// figure tag
				  "sales" /// data
				  "log_sales"	/// yVar
				  "(valeant_ind == 0 & cross_market == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph


* Split effect (HSR) of horizontal acquisitions on fraction covered
mergerPaperFigure "Figure OA17a1"	/// figure tag
				  "coverage" /// data
				  "frcov"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure OA17a2"	/// figure tag
				  "coverage" /// data
				  "frcov"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure OA17a1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure OA17a2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(-0.3(0.1)0.2, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA17a.pdf", as(pdf) replace



* Split effect (HSR) of horizontal acquisitions on fraction unrestricted
mergerPaperFigure "Figure OA17b1"	/// figure tag
				  "coverage" /// data
				  "frunr"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure OA17b2"	/// figure tag
				  "coverage" /// data
				  "frunr"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure OA17b1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure OA17b2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(-0.3(0.1)0.2, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(2) region(color(none)))
graph export "${paperdir}\Figures\Figure OA17b.pdf", as(pdf) replace

* Split effect (HSR) of horizontal acquisitions on fraction preferred
mergerPaperFigure "Figure OA17c1"	/// figure tag
				  "coverage" /// data
				  "frpre"	/// yVar
				  "(valeant_ind == 0 & overlap_stealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph
mergerPaperFigure "Figure OA17c2"	/// figure tag
				  "coverage" /// data
				  "frpre"	/// yVar
				  "(valeant_ind == 0 & overlap_nonstealth == 1)"	/// sample selection rules
				  "3"	/// span
				  "NO"	// graph

use "${coeffdir}\stacked-DiD\Figure OA17c1.dta", clear
rename diff* below_diff*
replace t = t - 0.025
merge 1:1 t using "${coeffdir}\stacked-DiD\Figure OA17c2.dta"
replace t = t + 0.025 if _merge == 2

twoway	(connect below_diff diff t, ///
			color(gs0 gs0) lpattern(solid dash) msymbol(O S)) ///
		(rspike below_diff_lb below_diff_ub t, ///
			lcolor(gs0)) ///
		(rspike diff_lb diff_ub t, ///
			lcolor(gs0)), ///
	xtitle("Years from acquisition", height(5)) xlabel(-3(1)3) ///
	ytitle("Change relative to year prior to acquisition") ///
	ylabel(-0.3(0.1)0.2, format(%4.1f)) xline(0, lcolor(gs10%50) lwidth(*15)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 1 "Horizontal acquisitions" "below HSR threshold") cols(1) ///
			   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA17c.pdf", as(pdf) replace

////////	E.2	Spillover effects of stealth horizontal acquisitions

* Same ATC-3 drugs
mergerPaperFigure "Figure OA18a"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & placebo == 0 & stlth_same_atc3_spill == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

* Same ATC-4 drugs)
mergerPaperFigure "Figure OA18c"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & placebo == 0 & stlth_same_atc3_comp == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph



////////	E.4	Acquisitions by smaller companies

* Effect of cross-market acquisitions by smaller company on net price
mergerPaperFigure "Figure OA19a"	/// figure tag
				  "sales" /// data
				  "w_log_net"	/// yVar
				  "(valeant_ind == 0 & placebo == 0 & overlap == 0 & sm_acq == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

* Effect of cross-market acquisitions by smaller company on volume
mergerPaperFigure "Figure OA20a"	/// figure tag
				  "sales" /// data
				  "log_units"	/// yVar
				  "(valeant_ind == 0 & placebo == 0 & overlap == 0 & sm_acq == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

* Effect of cross-market acquisitions by smaller company on coverage
mergerPaperFigure "Figure OA20b"	/// figure tag
				  "coverage" /// data
				  "glp"	/// yVar
				  "(valeant_ind == 0 & placebo == 0 & overlap == 0 & sm_acq == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph

mergerPaperFigure "Figure OA20c"	/// figure tag
				  "sales" /// data
				  "log_sales"	/// yVar
				  "(valeant_ind == 0 & placebo == 0 & overlap == 0 & sm_acq == 1)"	/// sample selection rules
				  "3"	/// span
				  "YES"	// graph
				  

*** END CODE
